import React from 'react'

import PropTypes from 'prop-types'

export default class GrandSon extends React.Component {
  constructor(){
    super()
    this.state = {
       
    }
  }

  // 3. 子组件中对父组件传过来的数据进行属性校验
  static contextTypes = {
    msg: PropTypes.string
  }

  render(){
    // 4. 使用 this.context.msg 访问父组件传过来的数据
    console.log(this.context.msg)
    return <div>
       <h3>孙子组件</h3>
       <h4>{this.context.msg}</h4>
    </div>
  }
}